<?php
$pic_types = array("jpg", "jpeg", "gif", "png");
$area = $_REQUEST["area"];
$section = $_REQUEST["section"];
$module = "{$_SERVER["DOCUMENT_ROOT"]}/modules/section_header/templates/{$area}/{$section}/images/banner";


$files = array();

$dirhandler = opendir($module);
$nofiles=0;
while ($file = readdir($dirhandler)) {
        if(in_array(substr(strtolower($file), strrpos($file,".") + 1),$pic_types)) {
            $files[$nofiles]=$file;
            $nofiles++;
        }  
}



echo json_encode($files);


?>
